<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <script>
    //字面量对象 <==> 类似 JSON对象
    var obj = {
      name: '李亚',
      sex: '女',
      age: 20,
      study: function () {
        console.log("学习");
      }
    }
    console.dir(obj);
    console.log(obj);
    console.log(obj.name);
    console.log(obj["age"]);
    obj.study();
    // 2 new Object创建对象
    var p = new Object();
    p.name = '康启航'
    p.age = 20;
    p.sex = '男'
    console.log(p);
    //3 构造器
    function Person (name, age) {
      this.name = name;
      this.age = age;
      this.say = function () {
        console.log('说话');
      }
    }
    var p2 = new Person('康启航', 20);
    console.log(p2);
  </script>

</body>

</html>